package thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class Demo23 {
    public static void main(String[] args) {
        BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(10);
        queue.add(1);
        queue.add(2);
        queue.add(3);
        queue.add(4);

        for (int i = 0; i < 4; i++) {
            System.out.println(queue.poll());
        }
    }
}
